\section{Linux Installation}

\subsection{Dependencies}

The following libraries must be installed and configured properly before the
game can be compiled and run. Each library will have its own dependencies, which
if not installed are identified before compilation. Often these can be installed
by using the synaptic package manager (Ubuntu/Debian distros). Use the \verb"apt-get"
(run in superuser mode) command to install missing packages. Running
\verb"apt-get update" will refresh your local package list. The command
\verb"aptitude search" is also useful for finding packages. The following
instructions for installation of each dependency are a guide, and may not be
correct for all systems. This guide has been tested on Ubuntu 8.10.

\subsubsection{OIS}

Install from source\footnote{\url{www.sourceforge.net/projects/wgois}}.

\begin{verbatim}
    wget http://downloads.sourceforge.net/wgois/ois_1.2.0.tar.gz
    tar xzf ois_1.2.0.tar.gz
    cd ois
    aclocal
    ./bootstrap
    ./configure
    make
    sudo make install
\end{verbatim}

\subsubsection{OGRE}

It is best to build OGRE from source, you can obtain this from the
website\footnote{\url{www.ogre3d.org}}. The wiki has a detailed guide for
doing
this\footnote{\url{www.ogre3d.org/wiki/index.php/Building_From_Source#Linux}}.
There is also a detailed guide for installing on
Ubuntu\footnote{\url{www.ogre3d.org/wiki/index.php/Building_From_Source#Ubuntu_.2F_Kubuntu}}.
OGRE requires a number of extra packages, for instance you will need to install
FreeImage and the nVidia Cg libraries.

\begin{verbatim}
    svn co https://svn.ogre3d.org/svnroot/ogre/branches/v1-4 ogrenew
    cd ogrenew
    ./bootstrap
    ./configure
    make
    sudo make install
    sudo ldconfig
\end{verbatim}

\subsubsection{CEGUI}

CEGUI must be built from source so that it is set to use the tinyxml parser. The
source can be obtained from the website\footnote{\url{www.cegui.org.uk}} either from
a stable release or from the SVN trunk. There are full build installation
instructions in the
wiki\footnote{\url{www.cegui.org.uk/wiki/index.php/HOWTO:_Obtain_the_library_source_from_subversion}}.

\begin{verbatim}
./bootstrap
./configure --with-default-xml-parser=TinyXMLParser
make
sudo make install
\end{verbatim}

\noindent
If running \verb"./bootstrap" gives the following message

\begin{verbatim}
You should add the contents of `/usr/share/aclocal/libtool.m4'
\end{verbatim}

\noindent
Then run \verb"aclocal" and \verb"./bootstrap" again. If you encounter the
following error when running make:

\begin{verbatim}
    /usr/local/lib/libCEGUIOgreRenderer-1.4.6.so: undefined reference to
    `CEGUI::Exception::Exception(CEGUI::String const&)'
    collect2: ld returned 1 exit status
    make[3]: *** [Demo4] Error 1
\end{verbatim}

\noindent
then the Ogre samples could not be built. You can disable these from being built
by rerunning \verb"configure" like this:

\begin{verbatim}
    ./configure --with-default-xml-parser=TinyXMLParser --disable-samples
\end{verbatim}

\noindent
There are cross-dependencies between CEGUI and OGRE so you will need to rebuild
OGRE after installing CEGUI.


\subsubsection{OpenAL}

Either install from source or obtain from the package manager:

\begin{verbatim}
    sudo apt-get install libopenal-dev libopenal0a libalut-dev
\end{verbatim}

\subsubsection{Newton and OgreNewt}

These libraries require Scons\footnote{\url{www.scons.org}} and
Boost\footnote{\url{www.boost.org}}. There is a bug affecting the OgreNewt
\verb"setCallBack" functions, causing segmentation faults. It is better to
install Boost from source, but you can try installing with the package manager.
If you have installed from source, then you must specify the directory path
with the argument \verb"boost=/path/to/boost" to both runs of \verb"Scons".

\begin{verbatim}
    sudo apt-get install scons boost-build libboost-dev
\end{verbatim}

\noindent
The OGRE wiki provides detailed installation
instructions\footnote{\url{www.ogre3d.org/wiki/index.php/OgreNewt_Linux_Installation}}
but here is an outline. First you need Newton:

\begin{verbatim}
    wget http://www.newtondynamics.com/downloads/newtonLinux-1.53.tar.gz
    tar xzf newtonLinux-1.53.tar.gz
    cd newtonSDK/sdk/
    sudo cp -R customJoints /usr/include
    sudo cp libNewton.a /usr/lib
\end{verbatim}

\noindent
You then need to modify the Newton header file (\verb"Newton.h") and put on the first line

\begin{verbatim}
    #include <stddef.h>
\end{verbatim}

\noindent
Then copy it to your include directory.

\begin{verbatim}
    sudo cp Newton.h /usr/include
\end{verbatim}

\noindent
Now you need to obtain the OgreNewt source, which you can do as follows:

\begin{verbatim}
    cvs -z3 -d:pserver:anonymous@cvs.ogre3d.org:/cvsroot/ogre co -P ogreaddons/ogrenewt
\end{verbatim}

\noindent
The noted instructions do not mention it but you will need to
remove the following line from \verb"SConscript":

\begin{verbatim}
    sources.remove('src/OgreNewt_BasicFrameListener.cpp');
\end{verbatim}

\noindent
Then you can finish the build and install. If \verb"scons" cannot
locate your Boost installation, then you can specify with the argument
\verb"boost=/usr/...".

\begin{verbatim}
    mv SConscript OgreNewt_Main
    scons
    sudo scons install prefix=/usr
\end{verbatim}

\subsection{Building From Source}

Edit \verb"~/.bashrc" file and add the following lines. Your may need to adjust
the path depending on where OGRE was installed.

\begin{verbatim}
    export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/pkgconfig:/usr/lib/local/pkgconfig
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib:/usr/local/lib:/usr/local/lib/OGRE
\end{verbatim}

\noindent
Then grab the source code for the game:

\begin{verbatim}
    svn checkout https://totoromotionpod.googlecode.com/svn/trunk iamorb
\end{verbatim}

\noindent
You then need to copy the package configuration files as follows:

\begin{verbatim}
    sudo cp iamorb/linux_files/NEWTON.pc /usr/local/lib/pkgconfig
    sudo cp iamorb/linux_files/OGRENEWT.pc /usr/local/lib/pkgconfig
    sudo cp iamorb/linux_files/CEGUI.pc /usr/local/lib/pkgconfig
\end{verbatim}

\noindent
Then you can build and run the game.

\begin{verbatim}
    cd iamorb/game
    make
    ./iamorb (with -pod if playing with the motion pod)
\end{verbatim}

\subsection{Issues}

As was briefly mentioned, there is a bug affecting some of the functions used
in OgreNewt that depend on the Boost libraries. This will cause a segmentation
fault when the first frame of a level is rendered. One workaround for the
bug is to use the Boost files provided with OgreNewt. To do this you must
remove any previous boost installation, and copy the Boost directory from
OgreNewt (\verb"OgreNewt_Main/inc/boost/") into \verb"/usr/include" or
\verb"/usr/local/include/", and then rebuild and reinstall OgreNewt.
